package com.qf.shop.entity;

public class Page {
    private int pageIndex;
    private int pageSize;
    private int totalCount;
    private int totalPage;
    private int startRows;

    public Page(int pageIndex) {
        this(pageIndex,8);
    }

    public Page(int pageIndex, int pageSize) {
        this.pageIndex = pageIndex;
        this.pageSize = pageSize;
        this.startRows = (pageIndex - 1 ) * pageSize;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
        this.totalPage = totalCount % pageSize ==0?totalCount/pageSize :(totalCount / pageSize) + 1;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public int getStartRows() {
        return startRows;
    }

    public int getPageIndex() {
        return pageIndex;
    }
}
